/*
 * Title:        CloudScheduler Toolkit
 * Description:  a Toolkit for Modeling and Simulation of Job Scheduling and Resource Provisioning in Cloud System
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 * Author:       Fuhui Wu
 *
 * Copyright (c) 2013-2014, The National University of Defense Technology, China
 */

package org.nudt.jCloud.infrastructure;

import java.util.List;

public class Slot {
	private Host host;
	private List<Pe> peList;
	private int ram;
	private int bw;
	private int storage;

	public Slot(Host host, List<Pe> peList, int ram, int bw, int storage) {
		setHost(host);
		setPeList(peList);
		setRam(ram);
		setBw(bw);
		setStorage(storage);
	}
	
	public boolean accommodate(SlotType slotType){
		if(this.peList.size()>=slotType.getPeCount() &&
				this.ram>=slotType.getRam() &&
				this.bw>=slotType.getBw() &&
				this.storage>=slotType.getStorage()){
			return true;
		}else{
			return false;
		}
	}
	
	public SlotType getSlotType(){
		SlotType slotType = new SlotType(getPeList().size(), getRam(), getBw(), getStorage());
		return slotType;
	}

	/**
	 * @return the host
	 */
	public Host getHost() {
		return host;
	}

	/**
	 * @param host the host to set
	 */
	public void setHost(Host host) {
		this.host = host;
	}

	/**
	 * @return the peList
	 */
	public List<Pe> getPeList() {
		return peList;
	}

	/**
	 * @param peList the peList to set
	 */
	public void setPeList(List<Pe> peList) {
		this.peList = peList;
	}

	/**
	 * @return the ram
	 */
	public int getRam() {
		return ram;
	}

	/**
	 * @param ram the ram to set
	 */
	public void setRam(int ram) {
		this.ram = ram;
	}

	/**
	 * @return the bw
	 */
	public int getBw() {
		return bw;
	}

	/**
	 * @param bw the bw to set
	 */
	public void setBw(int bw) {
		this.bw = bw;
	}

	/**
	 * @return the storage
	 */
	public int getStorage() {
		return storage;
	}

	/**
	 * @param storage the storage to set
	 */
	public void setStorage(int storage) {
		this.storage = storage;
	}

}
